﻿using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.Finance.Dto;
using Volo.Abp.Application.Dtos;


namespace NP.BPMReportPlatform.Finance
{
   
    /// <summary>
    /// 财务接口
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/finance")]
    public class TransferFixController : BPMReportPlatformController
    {
        private readonly ITransferFixService _transferFixService;

        public TransferFixController(ITransferFixService transferFixService)
        {
            _transferFixService = transferFixService;
        }

        /// <summary>
        /// 保理平台ukey及账户申请流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TransferFix/GetAll")]
        public async Task<PagedResultDto<TransferFixOutput>> GetAll([FromBody] GetTransferFixInput input)
        {
            return await _transferFixService.GetAllAsync(input);
        }

        /// <summary>
        /// 保理平台ukey及账户申请流程导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TransferFix/Export")]
        public async Task<XlsxFileResult<TransferFixOutput>> Export([FromBody] GetTransferFixInput input)
        {
            var rst = await _transferFixService.ExportAsync(input);
            return new XlsxFileResult<TransferFixOutput>(rst, "导出Excel");
        }
    }
}
